/*
 * Project Name spring-boot-tools
 * File Name ConnectionFilter
 * Package Name com.huxiaosu.tools.cmpp.filter
 * Create Time 2024/4/18
 * Create by name：liujie
 */
package com.huxiaosu.tools.cmpp.filter;

import lombok.extern.slf4j.Slf4j;
import org.apache.mina.core.filterchain.IoFilterAdapter;
import org.apache.mina.core.session.IoSession;

import java.net.InetSocketAddress;

/**
 * Description
 *
 * @author liujie
 * @date 2024/4/18 23:33
 */
@Slf4j
public class ConnectionFilter extends IoFilterAdapter {

    @Override
    public void messageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception {
        InetSocketAddress socketAddress = (InetSocketAddress) session.getRemoteAddress();
        log.info("<远程服务器地址{}>", socketAddress.getAddress().getHostAddress());
        nextFilter.messageReceived(session, message);
    }

}